/**
 *
 */
import OpenApi;
import OpenApi.OpenApiUtil;

extends OpenApi;


init(config: OpenApiUtil.Config){
  super(config);
  @signatureAlgorithm = 'v2';
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('governance', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!$isNull(endpoint)) {
    return endpoint;
  }
  
  if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model BatchEnrollAccountsRequest {
  accounts?: [ 
    {
      accountUid?: long(name='AccountUid', description='The account ID. This parameter is required.', example='12868156179****'),
    }
  ](name='Accounts', description='The resource accounts.'),
  baselineId?: string(name='BaselineId', description='The baseline ID.

If this parameter is left empty, the default baseline is used.', example='afb-bp1durvn3lgqe28v****'),
  baselineItems?: [ 
    {
      config?: string(name='Config', description='The configurations of the baseline item.', example='{\\\\"Notifications\\\\":[{\\\\"GroupKey\\\\":\\\\"account_msg\\\\",\\\\"Contacts\\\\":[{\\\\"Name\\\\":\\\\"aa\\\\"}],\\\\"PmsgStatus\\\\":1,\\\\"EmailStatus\\\\":1,\\\\"SmsStatus\\\\":1}]}'),
      name?: string(name='Name', description='The name of the baseline item.', example='ACS-BP_ACCOUNT_FACTORY_VPC'),
      skip?: boolean(name='Skip', description='Specifies whether to skip the baseline item. Valid values:

*   false
*   true', example='false'),
      version?: string(name='Version', description='The version of the baseline item.', example='1.0'),
    }
  ](name='BaselineItems', description='The baseline items.

If this parameter is specified, the configurations of the baseline items are merged with the baseline applied to the specified account. The configurations of the same baseline items are subject to the configurations of this parameter. We recommend that you leave this parameter empty and configure the `BaselineId` parameter to specify an account baseline and apply the configurations of the account baseline to the account.'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
}

model BatchEnrollAccountsResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='16B208DD-86BD-5E7D-AC93-FFD44B6FBDF1'),
}

model BatchEnrollAccountsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BatchEnrollAccountsResponseBody(name='body'),
}

/**
 * @summary Applies an account baseline to multiple existing resource accounts at a time.
 *
 * @description You can call this operation to apply an account baseline to existing resource accounts.
 * Accounts are enrolled in the account factory in asynchronous mode. After a resource account is created, an account baseline is applied to the account. You can call the [GetEnrolledAccount](https://help.aliyun.com/document_detail/609062.html) operation to query the details of the account enrolled in the account factory and check whether the account baseline is applied to the account.
 *
 * @param request BatchEnrollAccountsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return BatchEnrollAccountsResponse
 */
async function batchEnrollAccountsWithOptions(request: BatchEnrollAccountsRequest, runtime: $RuntimeOptions): BatchEnrollAccountsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accounts)) {
    query['Accounts'] = request.accounts;
  }
  if (!$isNull(request.baselineId)) {
    query['BaselineId'] = request.baselineId;
  }
  if (!$isNull(request.baselineItems)) {
    query['BaselineItems'] = request.baselineItems;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'BatchEnrollAccounts',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Applies an account baseline to multiple existing resource accounts at a time.
 *
 * @description You can call this operation to apply an account baseline to existing resource accounts.
 * Accounts are enrolled in the account factory in asynchronous mode. After a resource account is created, an account baseline is applied to the account. You can call the [GetEnrolledAccount](https://help.aliyun.com/document_detail/609062.html) operation to query the details of the account enrolled in the account factory and check whether the account baseline is applied to the account.
 *
 * @param request BatchEnrollAccountsRequest
 * @return BatchEnrollAccountsResponse
 */
async function batchEnrollAccounts(request: BatchEnrollAccountsRequest): BatchEnrollAccountsResponse {
  var runtime = new $RuntimeOptions{};
  return batchEnrollAccountsWithOptions(request, runtime);
}

model CreateAccountFactoryBaselineRequest {
  baselineItems?: [ 
    {
      config?: string(name='Config', description='The configurations of the baseline item. The value of this parameter is a JSON string.', example='{\\\\"EnabledServices\\\\":[\\\\"CEN_TR\\\\",\\\\"CDT\\\\",\\\\"CMS\\\\",\\\\"KMS\\\\"]}'),
      name?: string(name='Name', description='The name of the baseline item.', example='ACS-BP_ACCOUNT_FACTORY_VPC'),
      version?: string(name='Version', description='The version of the baseline item.', example='1.0'),
    }
  ](name='BaselineItems', description='An array that contains the baseline items.

You can call the [ListAccountFactoryBaselineItems](~~ListAccountFactoryBaselineItems~~) operation to query a list of baseline items supported by the account factory in Cloud Governance Center.'),
  baselineName?: string(name='BaselineName', description='The name of the baseline.', example='Default'),
  description?: string(name='Description', description='The description of the baseline.', example='Default Baseline.'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
}

model CreateAccountFactoryBaselineResponseBody = {
  baselineId?: string(name='BaselineId', description='The baseline ID.', example='afb-bp1e6ixtiwupap8m****'),
  requestId?: string(name='RequestId', description='The request ID.', example='A5592E2E-0FC4-557C-B989-DF229B5EBE13'),
}

model CreateAccountFactoryBaselineResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAccountFactoryBaselineResponseBody(name='body'),
}

/**
 * @summary Creates a baseline of the account factory.
 *
 * @param request CreateAccountFactoryBaselineRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAccountFactoryBaselineResponse
 */
async function createAccountFactoryBaselineWithOptions(request: CreateAccountFactoryBaselineRequest, runtime: $RuntimeOptions): CreateAccountFactoryBaselineResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.baselineItems)) {
    query['BaselineItems'] = request.baselineItems;
  }
  if (!$isNull(request.baselineName)) {
    query['BaselineName'] = request.baselineName;
  }
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateAccountFactoryBaseline',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a baseline of the account factory.
 *
 * @param request CreateAccountFactoryBaselineRequest
 * @return CreateAccountFactoryBaselineResponse
 */
async function createAccountFactoryBaseline(request: CreateAccountFactoryBaselineRequest): CreateAccountFactoryBaselineResponse {
  var runtime = new $RuntimeOptions{};
  return createAccountFactoryBaselineWithOptions(request, runtime);
}

model DeleteAccountFactoryBaselineRequest {
  baselineId?: string(name='BaselineId', description='The baseline ID.', example='afb-bp1durvn3lgqe28v****'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
}

model DeleteAccountFactoryBaselineResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='0F45D888-8C4D-55E5-ACA2-D1515159181D'),
}

model DeleteAccountFactoryBaselineResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteAccountFactoryBaselineResponseBody(name='body'),
}

/**
 * @summary Deletes an account factory baseline.
 *
 * @param request DeleteAccountFactoryBaselineRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteAccountFactoryBaselineResponse
 */
async function deleteAccountFactoryBaselineWithOptions(request: DeleteAccountFactoryBaselineRequest, runtime: $RuntimeOptions): DeleteAccountFactoryBaselineResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.baselineId)) {
    query['BaselineId'] = request.baselineId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteAccountFactoryBaseline',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes an account factory baseline.
 *
 * @param request DeleteAccountFactoryBaselineRequest
 * @return DeleteAccountFactoryBaselineResponse
 */
async function deleteAccountFactoryBaseline(request: DeleteAccountFactoryBaselineRequest): DeleteAccountFactoryBaselineResponse {
  var runtime = new $RuntimeOptions{};
  return deleteAccountFactoryBaselineWithOptions(request, runtime);
}

model EnrollAccountRequest {
  accountNamePrefix?: string(name='AccountNamePrefix', description='The prefix for the account name of the member.

*   If the account baseline is applied to an account that is newly created, you must configure this parameter.
*   If the account baseline is applied to an existing account, you do not need to configure this parameter.', example='test-account'),
  accountUid?: long(name='AccountUid', description='The account ID.

*   If the account baseline is applied to an account that is newly created, you do not need to configure this parameter.
*   If the account baseline is applied to an existing account, you must configure this parameter.', example='12868156179****'),
  baselineId?: string(name='BaselineId', description='The baseline ID.

If this parameter is left empty, the default baseline is used.', example='afb-bp1durvn3lgqe28v****'),
  baselineItems?: [ 
    {
      config?: string(name='Config', description='The configurations of the baseline item.', example='{\\\\"Notifications\\\\":[{\\\\"GroupKey\\\\":\\\\"account_msg\\\\",\\\\"Contacts\\\\":[{\\\\"Name\\\\":\\\\"aa\\\\"}],\\\\"PmsgStatus\\\\":1,\\\\"EmailStatus\\\\":1,\\\\"SmsStatus\\\\":1}]}'),
      name?: string(name='Name', description='The name of the baseline item.', example='ACS-BP_ACCOUNT_FACTORY_VPC'),
      skip?: boolean(name='Skip', description='Whether to skip the baseline item. Valid values:

*   false: The baseline item is not skipped.
*   true: The baseline item is skipped.', example='false'),
      version?: string(name='Version', description='The version of the baseline item.', example='1.0'),
    }
  ](name='BaselineItems', description='The array that contains baseline items.

If this parameter is specified, the configurations of the baseline items are merged with the baseline applied to the specified account. The configurations of the same baseline items are subject to the configurations of this parameter. We recommend that you leave this parameter empty and configure the `BaselineId` parameter to specify an account baseline and apply the configurations of the account baseline to the account.'),
  displayName?: string(name='DisplayName', description='The display name of the account.

*   If the account baseline is applied to an account that is newly created, you must configure this parameter.
*   If the account baseline is applied to an existing account, you do not need to configure this parameter.', example='test-account'),
  folderId?: string(name='FolderId', description='The ID of the parent folder.

*   If the account baseline is applied to an account that is newly created, you need to specify a parent folder. If you do not configure this parameter, the account is created in the Root folder.
*   If the account baseline is applied to an existing account, you do not need to configure this parameter.', example='fd-5ESoku****'),
  payerAccountUid?: long(name='PayerAccountUid', description='The ID of the billing account.

*   If the account baseline is applied to an account that is newly created, you need to specify a billing account. If you do not configure this parameter, the self-pay settlement method is used for the account.
*   If the account baseline is applied to an existing account, you do not need to configure this parameter.', example='19534534552****'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
  resellAccountType?: string(name='ResellAccountType', description='The identity type of the member. Valid values:

*   resell (default): The member is an account for a reseller. A relationship is automatically established between the member and the reseller. The management account of the resource directory must be used as the billing account of the member.
*   non_resell: The member is not an account for a reseller. The member is an account that is not associated with a reseller. You can directly use the account to purchase Alibaba Cloud resources. The member is used as its own billing account.

> This parameter is available only for resellers at the international site (alibabacloud.com).', example='resell'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key.', example='tagKey'),
      value?: string(name='Value', description='The tag value.', example='tagValue'),
    }
  ](name='Tag', description='The tags. You can specify up to 20 tags.'),
}

model EnrollAccountShrinkRequest {
  accountNamePrefix?: string(name='AccountNamePrefix', description='The prefix for the account name of the member.

*   If the account baseline is applied to an account that is newly created, you must configure this parameter.
*   If the account baseline is applied to an existing account, you do not need to configure this parameter.', example='test-account'),
  accountUid?: long(name='AccountUid', description='The account ID.

*   If the account baseline is applied to an account that is newly created, you do not need to configure this parameter.
*   If the account baseline is applied to an existing account, you must configure this parameter.', example='12868156179****'),
  baselineId?: string(name='BaselineId', description='The baseline ID.

If this parameter is left empty, the default baseline is used.', example='afb-bp1durvn3lgqe28v****'),
  baselineItems?: [ 
    {
      config?: string(name='Config', description='The configurations of the baseline item.', example='{\\\\"Notifications\\\\":[{\\\\"GroupKey\\\\":\\\\"account_msg\\\\",\\\\"Contacts\\\\":[{\\\\"Name\\\\":\\\\"aa\\\\"}],\\\\"PmsgStatus\\\\":1,\\\\"EmailStatus\\\\":1,\\\\"SmsStatus\\\\":1}]}'),
      name?: string(name='Name', description='The name of the baseline item.', example='ACS-BP_ACCOUNT_FACTORY_VPC'),
      skip?: boolean(name='Skip', description='Whether to skip the baseline item. Valid values:

*   false: The baseline item is not skipped.
*   true: The baseline item is skipped.', example='false'),
      version?: string(name='Version', description='The version of the baseline item.', example='1.0'),
    }
  ](name='BaselineItems', description='The array that contains baseline items.

If this parameter is specified, the configurations of the baseline items are merged with the baseline applied to the specified account. The configurations of the same baseline items are subject to the configurations of this parameter. We recommend that you leave this parameter empty and configure the `BaselineId` parameter to specify an account baseline and apply the configurations of the account baseline to the account.'),
  displayName?: string(name='DisplayName', description='The display name of the account.

*   If the account baseline is applied to an account that is newly created, you must configure this parameter.
*   If the account baseline is applied to an existing account, you do not need to configure this parameter.', example='test-account'),
  folderId?: string(name='FolderId', description='The ID of the parent folder.

*   If the account baseline is applied to an account that is newly created, you need to specify a parent folder. If you do not configure this parameter, the account is created in the Root folder.
*   If the account baseline is applied to an existing account, you do not need to configure this parameter.', example='fd-5ESoku****'),
  payerAccountUid?: long(name='PayerAccountUid', description='The ID of the billing account.

*   If the account baseline is applied to an account that is newly created, you need to specify a billing account. If you do not configure this parameter, the self-pay settlement method is used for the account.
*   If the account baseline is applied to an existing account, you do not need to configure this parameter.', example='19534534552****'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
  resellAccountType?: string(name='ResellAccountType', description='The identity type of the member. Valid values:

*   resell (default): The member is an account for a reseller. A relationship is automatically established between the member and the reseller. The management account of the resource directory must be used as the billing account of the member.
*   non_resell: The member is not an account for a reseller. The member is an account that is not associated with a reseller. You can directly use the account to purchase Alibaba Cloud resources. The member is used as its own billing account.

> This parameter is available only for resellers at the international site (alibabacloud.com).', example='resell'),
  tagShrink?: string(name='Tag', description='The tags. You can specify up to 20 tags.'),
}

model EnrollAccountResponseBody = {
  accountUid?: long(name='AccountUid', description='The account ID.', example='143165363236****'),
  requestId?: string(name='RequestId', description='The request ID.', example='7071E5FA-515E-5F53-B335-B87D619C6A66'),
}

model EnrollAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EnrollAccountResponseBody(name='body'),
}

/**
 * @summary Enrolls an account. You can create a new account or manage an existing account in the account factory.
 *
 * @description You can call this API operation to create a new account or manage an existing account and apply the account baseline to the account.
 * Accounts are created in asynchronous mode. After you create an account, you can apply the account baseline to the account. You can call the [GetEnrolledAccount API](~~GetEnrolledAccount~~) operation to view the details about the account to obtain the result of applying the account baseline to the account.
 *
 * @param tmpReq EnrollAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EnrollAccountResponse
 */
async function enrollAccountWithOptions(tmpReq: EnrollAccountRequest, runtime: $RuntimeOptions): EnrollAccountResponse {
  tmpReq.validate();
  var request = new EnrollAccountShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.tag)) {
    request.tagShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tag, 'Tag', 'json');
  }
  var query = {};
  if (!$isNull(request.accountNamePrefix)) {
    query['AccountNamePrefix'] = request.accountNamePrefix;
  }
  if (!$isNull(request.accountUid)) {
    query['AccountUid'] = request.accountUid;
  }
  if (!$isNull(request.baselineId)) {
    query['BaselineId'] = request.baselineId;
  }
  if (!$isNull(request.baselineItems)) {
    query['BaselineItems'] = request.baselineItems;
  }
  if (!$isNull(request.displayName)) {
    query['DisplayName'] = request.displayName;
  }
  if (!$isNull(request.folderId)) {
    query['FolderId'] = request.folderId;
  }
  if (!$isNull(request.payerAccountUid)) {
    query['PayerAccountUid'] = request.payerAccountUid;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resellAccountType)) {
    query['ResellAccountType'] = request.resellAccountType;
  }
  if (!$isNull(request.tagShrink)) {
    query['Tag'] = request.tagShrink;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'EnrollAccount',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Enrolls an account. You can create a new account or manage an existing account in the account factory.
 *
 * @description You can call this API operation to create a new account or manage an existing account and apply the account baseline to the account.
 * Accounts are created in asynchronous mode. After you create an account, you can apply the account baseline to the account. You can call the [GetEnrolledAccount API](~~GetEnrolledAccount~~) operation to view the details about the account to obtain the result of applying the account baseline to the account.
 *
 * @param request EnrollAccountRequest
 * @return EnrollAccountResponse
 */
async function enrollAccount(request: EnrollAccountRequest): EnrollAccountResponse {
  var runtime = new $RuntimeOptions{};
  return enrollAccountWithOptions(request, runtime);
}

model GetAccountFactoryBaselineRequest {
  baselineId?: string(name='BaselineId', description='The baseline ID.', example='afb-bp1nf0enuzb89az*****'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
}

model GetAccountFactoryBaselineResponseBody = {
  baselineId?: string(name='BaselineId', description='The baseline ID.', example='afb-bp16ae2k8a3yo3d*****'),
  baselineItems?: [ 
    {
      config?: string(name='Config', description='The configuration of the baseline item.

The value is a JSON string.', example='{\\\\"Notifications\\\\":[{\\\\"GroupKey\\\\":\\\\"account_msg\\\\",\\\\"Contacts\\\\":[{\\\\"Name\\\\":\\\\"aa\\\\"}],\\\\"PmsgStatus\\\\":1,\\\\"EmailStatus\\\\":1,\\\\"SmsStatus\\\\":1}]}'),
      name?: string(name='Name', description='The name of the baseline item.', example='1097526274671790'),
      version?: string(name='Version', description='The version of the baseline item.', example='1.0'),
    }
  ](name='BaselineItems', description='The baseline items.'),
  baselineName?: string(name='BaselineName', description='The name of the baseline.', example='Default'),
  createTime?: string(name='CreateTime', description='The time when the baseline was created.', example='2022-11-28T00:46:34Z'),
  description?: string(name='Description', description='The description of the baseline.', example='Default baseline'),
  requestId?: string(name='RequestId', description='The request ID.', example='60D54503-F1F6-51B6-B6FA-A70CBDA2A68C'),
  type?: string(name='Type', description='The type of the baseline. Valid values:

*   System: default baseline.
*   Custom: custom baseline.', example='Custom'),
  updateTime?: string(name='UpdateTime', description='The time when the baseline was updated.', example='2022-11-02T01:00:07Z'),
}

model GetAccountFactoryBaselineResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAccountFactoryBaselineResponseBody(name='body'),
}

/**
 * @summary Obtains the details of an account factory baseline.
 *
 * @param request GetAccountFactoryBaselineRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAccountFactoryBaselineResponse
 */
async function getAccountFactoryBaselineWithOptions(request: GetAccountFactoryBaselineRequest, runtime: $RuntimeOptions): GetAccountFactoryBaselineResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.baselineId)) {
    query['BaselineId'] = request.baselineId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetAccountFactoryBaseline',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Obtains the details of an account factory baseline.
 *
 * @param request GetAccountFactoryBaselineRequest
 * @return GetAccountFactoryBaselineResponse
 */
async function getAccountFactoryBaseline(request: GetAccountFactoryBaselineRequest): GetAccountFactoryBaselineResponse {
  var runtime = new $RuntimeOptions{};
  return getAccountFactoryBaselineWithOptions(request, runtime);
}

model GetEnrolledAccountRequest {
  accountUid?: long(name='AccountUid', description='The account ID.

This parameter is required.', example='19534534552****'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
}

model GetEnrolledAccountResponseBody = {
  accountUid?: long(name='AccountUid', description='The account ID.', example='12868156179*****'),
  baselineId?: string(name='BaselineId', description='The ID of the baseline that is implemented.', example='afb-bp1adadfadsf***'),
  baselineItems?: [ 
    {
      config?: string(name='Config', description='The configuration of the baseline item.', example='{\\\\"Notifications\\\\":[{\\\\"GroupKey\\\\":\\\\"account_msg\\\\",\\\\"Contacts\\\\":[{\\\\"Name\\\\":\\\\"aa\\\\"}],\\\\"PmsgStatus\\\\":1,\\\\"EmailStatus\\\\":1,\\\\"SmsStatus\\\\":1}]}'),
      name?: string(name='Name', description='The name of the baseline item.', example='ACS-BP_ACCOUNT_FACTORY_VPC'),
      skip?: boolean(name='Skip', description='Indicates whether baseline item is skipped. Valid values:

*   false
*   true', example='false'),
      version?: string(name='Version', description='The version of the baseline item.', example='1.0'),
    }
  ](name='BaselineItems', description='The array that contains baseline items.'),
  createTime?: string(name='CreateTime', description='The time when the account was created.', example='2021-11-01T02:38:27Z'),
  displayName?: string(name='DisplayName', description='The display name of the account.', example='test-account'),
  errorInfo?: {
    code?: string(name='Code', description='The error code.', example='CompliancePackExists'),
    message?: string(name='Message', description='The error message.', example='The compliance pack already exists.'),
    recommend?: string(name='Recommend', description='The recommended solution.', example='https://next.api.aliyun.com/troubleshoot?q=CompliancePackExists\\\\\\\\u0026product=Config'),
    requestId?: string(name='RequestId', description='The request ID.', example='6D5EAA86-2D41-5CB7-8DA7-B60093ACAA4E'),
  }(name='ErrorInfo', description='The error message.

>  This parameter is returned if the value of `Status` is `Failed` or `ScheduleFailed`.'),
  folderId?: string(name='FolderId', description='The ID of the parent folder.', example='fd-5ESoku****'),
  initialized?: boolean(name='Initialized', description='Indicates whether the initialization is complete. Valid values:

*   false
*   true', example='true'),
  inputs?: {
    accountNamePrefix?: string(name='AccountNamePrefix', description='The prefix of the account name.', example='test-account'),
    accountUid?: long(name='AccountUid', description='The account ID.', example='12868156179*****'),
    baselineItems?: [ 
      {
        config?: string(name='Config', description='The configurations of the baseline item.', example='{\\\\"Contacts\\\\":[{\\\\"Name\\\\":\\\\"governance\\\\",\\\\"Email\\\\":\\\\"wibud****@gmail.com\\\\",\\\\"Mobile\\\\":\\\\"1234\\\\",\\\\"Position\\\\":\\\\"Other\\\\"}]}'),
        name?: string(name='Name', description='The name of the baseline item.', example='ACS-BP_ACCOUNT_FACTORY_VPC'),
        skip?: boolean(name='Skip', description='Indicates whether baseline item is skipped. Valid values:

*   false
*   true', example='false'),
        version?: string(name='Version', description='The version of the baseline item.', example='1.0'),
      }
    ](name='BaselineItems', description='The baseline items.'),
    displayName?: string(name='DisplayName', description='The display name of the account.', example='test-account'),
    folderId?: string(name='FolderId', description='The ID of the parent folder.', example='fd-5ESoku****'),
    payerAccountUid?: long(name='PayerAccountUid', description='The ID of the settlement account.', example='19534534552*****'),
    tag?: [ 
      {
        key?: string(name='Key', description='The tag key.', example='product'),
        value?: string(name='Value', description='The tag value.', example='governance'),
      }
    ](name='Tag', description='The tag.'),
  }(name='Inputs', description='Input parameters used to create an account.'),
  masterAccountUid?: long(name='MasterAccountUid', description='The ID of the management account of the resource directory to which the account belongs.', example='19534534552*****'),
  payerAccountUid?: long(name='PayerAccountUid', description='The ID of the settlement account.', example='19534534552*****'),
  progress?: [ 
    {
      name?: string(name='Name', description='The name of the baseline item.', example='ACS-BP_ACCOUNT_FACTORY_VPC'),
      status?: string(name='Status', description='The status of applying the baseline to the account. Valid values:

*   Pending: The baseline is pending to be applied to the account.
*   Running: The baseline is being applied to the account.
*   Finished: : The baseline is applied to the account.
*   Failed: : The baseline fails to be applied to the account.', example='Running'),
    }
  ](name='Progress', description='The progress of the applying the baseline to the account.'),
  requestId?: string(name='RequestId', description='The request ID.', example='768F908D-A66A-5A5D-816C-20C93CBBFEE3'),
  status?: string(name='Status', description='The status of the account. Valid values:

*   Pending: The account is pending to be created.
*   Running: The account is being created.
*   Finished: The account is created.
*   Failed: The account fails to be created.
*   Scheduling: The account is being scheduled.
*   ScheduleFailed: The account fails to be scheduled.', example='Finished'),
  updateTime?: string(name='UpdateTime', description='The update time.', example='2021-11-01T02:38:27Z'),
}

model GetEnrolledAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetEnrolledAccountResponseBody(name='body'),
}

/**
 * @summary Queries the details about an account that is enrolled in the account factory.
 *
 * @param request GetEnrolledAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetEnrolledAccountResponse
 */
async function getEnrolledAccountWithOptions(request: GetEnrolledAccountRequest, runtime: $RuntimeOptions): GetEnrolledAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountUid)) {
    query['AccountUid'] = request.accountUid;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetEnrolledAccount',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the details about an account that is enrolled in the account factory.
 *
 * @param request GetEnrolledAccountRequest
 * @return GetEnrolledAccountResponse
 */
async function getEnrolledAccount(request: GetEnrolledAccountRequest): GetEnrolledAccountResponse {
  var runtime = new $RuntimeOptions{};
  return getEnrolledAccountWithOptions(request, runtime);
}

model ListAccountFactoryBaselineItemsRequest {
  maxResults?: int32(name='MaxResults', description='The maximum number of entries per page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  names?: [ string ](name='Names', description='The names of the baseline items.'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request.', example='AAAAACDGQdAEX3m42z3sQ+f3VTK2Xr2DzYbz/SAfc/zJRqod'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
  type?: string(name='Type', description='The type of the baseline items.', example='AccountFactory'),
  versions?: [ string ](name='Versions', description='The versions of the baseline items.'),
}

model ListAccountFactoryBaselineItemsResponseBody = {
  baselineItems?: [ 
    {
      dependsOn?: [ 
        {
          name?: string(name='Name', description='The name of the baseline item.', example='ACS-BP_ACCOUNT_FACTORY_VPC'),
          type?: string(name='Type', description='The type of the baseline item.', example='AccountFactory'),
          version?: string(name='Version', description='The version of the baseline item.', example='1.0'),
        }
      ](name='DependsOn', description='The dependency of the baseline item.'),
      description?: string(name='Description', description='The description of the baseline item.', example='Notification.'),
      name?: string(name='Name', description='The name of the baseline item.', example='ACS-BP_ACCOUNT_FACTORY_ACCOUNT_NOTIFICATION'),
      type?: string(name='Type', description='The type of the baseline item.', example='AccountFactory'),
      version?: string(name='Version', description='The version of the baseline item.', example='1.0'),
    }
  ](name='BaselineItems', description='The baseline items.'),
  nextToken?: string(name='NextToken', description='The returned value of NextToken is a pagination token, which can be used in the next request to retrieve a new page of results.', example='AAAAACDGQdAEX3m42z3sQ+f3VTK2Xr2DzYbz/SAfc/zJRqod'),
  requestId?: string(name='RequestId', description='The request ID.', example='B40D73D8-76AC-5D3C-AC63-4FC8AFCE6671'),
}

model ListAccountFactoryBaselineItemsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAccountFactoryBaselineItemsResponseBody(name='body'),
}

/**
 * @summary Queries a list of baseline items that are supported by the account factory of Cloud Governance Center (CGC).
 *
 * @param request ListAccountFactoryBaselineItemsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAccountFactoryBaselineItemsResponse
 */
async function listAccountFactoryBaselineItemsWithOptions(request: ListAccountFactoryBaselineItemsRequest, runtime: $RuntimeOptions): ListAccountFactoryBaselineItemsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!$isNull(request.names)) {
    query['Names'] = request.names;
  }
  if (!$isNull(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.type)) {
    query['Type'] = request.type;
  }
  if (!$isNull(request.versions)) {
    query['Versions'] = request.versions;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListAccountFactoryBaselineItems',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries a list of baseline items that are supported by the account factory of Cloud Governance Center (CGC).
 *
 * @param request ListAccountFactoryBaselineItemsRequest
 * @return ListAccountFactoryBaselineItemsResponse
 */
async function listAccountFactoryBaselineItems(request: ListAccountFactoryBaselineItemsRequest): ListAccountFactoryBaselineItemsResponse {
  var runtime = new $RuntimeOptions{};
  return listAccountFactoryBaselineItemsWithOptions(request, runtime);
}

model ListAccountFactoryBaselinesRequest {
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.

You do not need to specify this parameter for the first request.', example='AAAAALHWGpGoYCcYMxiFfmlhvh62Xr2DzYbz/SAfc*****'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
}

model ListAccountFactoryBaselinesResponseBody = {
  baselines?: [ 
    {
      baselineId?: string(name='BaselineId', description='The baseline ID.', example='afb-bp1durvn3lgqe28v****'),
      baselineName?: string(name='BaselineName', description='The name of the baseline.', example='Default'),
      createTime?: string(name='CreateTime', description='The time at which the baseline was created.', example='2021-11-30T09:09:28Z'),
      description?: string(name='Description', description='The description of the baseline.', example='Default baseline'),
      type?: string(name='Type', description='The type of the baseline. Valid values:

*   System: default baseline.
*   Custom: custom baseline.', example='Custom'),
      updateTime?: string(name='UpdateTime', description='The time when the baseline was updated.', example='2022-12-29T07:08:40Z'),
    }
  ](name='Baselines', description='The baselines.'),
  nextToken?: string(name='NextToken', description='The returned value of NextToken is a pagination token, which can be used in the next request to retrieve a new page of results.', example='AAAAALHWGpGoYCcYMxiFfmlhvh62Xr2DzYbz/SAfc*****'),
  requestId?: string(name='RequestId', description='The request ID.', example='3245E413-7CDD-5287-8988-6A94DE8A8369'),
}

model ListAccountFactoryBaselinesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAccountFactoryBaselinesResponseBody(name='body'),
}

/**
 * @summary Obtains a list of baselines in the account factory.
 *
 * @param request ListAccountFactoryBaselinesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAccountFactoryBaselinesResponse
 */
async function listAccountFactoryBaselinesWithOptions(request: ListAccountFactoryBaselinesRequest, runtime: $RuntimeOptions): ListAccountFactoryBaselinesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!$isNull(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListAccountFactoryBaselines',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Obtains a list of baselines in the account factory.
 *
 * @param request ListAccountFactoryBaselinesRequest
 * @return ListAccountFactoryBaselinesResponse
 */
async function listAccountFactoryBaselines(request: ListAccountFactoryBaselinesRequest): ListAccountFactoryBaselinesResponse {
  var runtime = new $RuntimeOptions{};
  return listAccountFactoryBaselinesWithOptions(request, runtime);
}

model ListEnrolledAccountsRequest {
  maxResults?: int32(name='MaxResults', description='The maximum number of entries per page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  nextToken?: string(name='NextToken', description='The returned value of NextToken is a pagination token, which can be used in the next request to retrieve a new page of results.

You do not need to specify this parameter for the first request.', example='AAAAALHWGpGoYCcYMxiFfmlhvh62Xr2DzYbz/SAfc*****'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
}

model ListEnrolledAccountsResponseBody = {
  enrolledAccounts?: [ 
    {
      accountUid?: long(name='AccountUid', description='The account ID.', example='19534534552*****'),
      baselineId?: string(name='BaselineId', description='The ID of the baseline that is implemented.', example='afb-bp1durvn3lgqe28v****'),
      createTime?: string(name='CreateTime', description='The creation time.', example='2021-11-01T02:38:27Z'),
      displayName?: string(name='DisplayName', description='The display name of the account.', example='TestAccount'),
      folderId?: string(name='FolderId', description='The ID of the parent folder.', example='fd-5ESoku****'),
      payerAccountUid?: long(name='PayerAccountUid', description='The ID of the settlement account.', example='13161210500*****'),
      status?: string(name='Status', description='The creation status. Valid values:

*   Pending: The account is pending to be created.
*   Running: The account is being created.
*   Finished: The account is created.
*   Failed: The account fails to be created.
*   Scheduling: The account is being scheduled.
*   ScheduleFailed: The account fails to be scheduled.', example='Running'),
      updateTime?: string(name='UpdateTime', description='The update time.', example='2021-11-01T02:38:27Z'),
    }
  ](name='EnrolledAccounts', description='The enrolled accounts.'),
  nextToken?: string(name='NextToken', description='The returned value of NextToken is a pagination token, which can be used in the next request to retrieve a new page of results.', example='AAAAALHWGpGoYCcYMxiFfmlhvh62Xr2DzYbz/SAfc*****'),
  requestId?: string(name='RequestId', description='The request ID.', example='768F908D-A66A-5A5D-816C-20C93CBBFEE3'),
}

model ListEnrolledAccountsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListEnrolledAccountsResponseBody(name='body'),
}

/**
 * @summary Queries a list of accounts that are enrolled in the account factory.
 *
 * @param request ListEnrolledAccountsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListEnrolledAccountsResponse
 */
async function listEnrolledAccountsWithOptions(request: ListEnrolledAccountsRequest, runtime: $RuntimeOptions): ListEnrolledAccountsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!$isNull(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListEnrolledAccounts',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries a list of accounts that are enrolled in the account factory.
 *
 * @param request ListEnrolledAccountsRequest
 * @return ListEnrolledAccountsResponse
 */
async function listEnrolledAccounts(request: ListEnrolledAccountsRequest): ListEnrolledAccountsResponse {
  var runtime = new $RuntimeOptions{};
  return listEnrolledAccountsWithOptions(request, runtime);
}

model ListEvaluationMetadataRequest {
  language?: string(name='Language', description='The language. The information is returned in the specified language. Valid values:

*   en: English
*   zh: Chinese', example='zh'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
}

model ListEvaluationMetadataResponseBody = {
  evaluationMetadata?: [ 
    {
      metadata?: [ 
        {
          category?: string(name='Category', description='The category of the check item.', example='Security'),
          description?: string(name='Description', description='The description of the check item.', example='If you use an AccessKey pair of an Alibaba Cloud account, you have full permissions on the resources of the account. You cannot set limits on the account, such as setting limits on source IP addresses or access duration. If the AccessKey pair is leaked, resources within the account are exposed to high security risks. If your Alibaba Cloud account has an existing AccessKey pair, the check result is Non-compliant.'),
          displayName?: string(name='DisplayName', description='The display name of the check item.', example='An AccessKey pair is enabled for the Alibaba Cloud account.'),
          id?: string(name='Id', description='The ID of the metadata.', example='pxgtda****'),
          recommendationLevel?: string(name='RecommendationLevel', description='The governance level of the check item.', example='High'),
          remediationMetadata?: {
            remediation?: [ 
              {
                actions?: [ 
                  {
                    classification?: string(name='Classification', description='The fixing method.

>  This parameter is returned only if the value of `RemediationType` is `Analysis`.', example='UnusedAccessKeyInRamUser'),
                    costDescription?: string(name='CostDescription', description='The fixing cost.', example='You are not charged for this operation.'),
                    description?: string(name='Description', description='The description of the fixing item.

>  This parameter is returned only if the value of `RemediationType` is `Analysis`.', example='Console logon is enabled for the RAM user. The RAM user owns an AccessKey pair that is never used.'),
                    guidance?: [ 
                      {
                        buttonName?: string(name='ButtonName', description='The display name of the fixing button.', example='Manual fixing'),
                        buttonRef?: string(name='ButtonRef', description='The navigation URL of the fixing button.', example='https://ram.console.aliyun.com/users'),
                        content?: string(name='Content', description='The fixing procedure.', example='You must replace the AccessKey pair of your Alibaba Cloud account. To do so, perform the following steps:</br>1. Log on to the RAM console. In the left-side navigation pane, choose Identities > Users. On the Users page, click Create User.</br>2. On the Create User page, enter a logon name and select OpenAPI Access for the Access Mode parameter.</br>3. After the RAM user is created, save the AccessKey pair. Then, find the user that you created on the Users page and click Add Permissions in the Actions column. In the Grant Permission panel, find the AdministratorAccess policy and attach it to the RAM user.</br>4. In a program, replace the AccessKey pair of the Alibaba Cloud account with the AccessKey pair of the RAM user created in the previous step and check whether the program runs as expected in the test environment.</br>5. If the program runs as expected, publish the program to the production environment and disable the previous AccessKey pair of your Alibaba Cloud account. Then, check whether the program runs as expected.</br>6. If the program runs as expected, delete the disabled AccessKey pair after the specified period of time, such as 90 days.'),
                        title?: string(name='Title', description='The title of the fixing procedure.', example='Scenario 3: AccessKey pair that is used within the last 90 days'),
                      }
                    ](name='Guidance', description='The content of the fixing items.'),
                    notice?: string(name='Notice', description='The usage notes of the fixing item.', example='The BestPracticesForIdentityAndPermissions compliance package is enabled in Cloud Config to check the settings and usage of the AccessKey pair, Alibaba Cloud account, and RAM users.'),
                    suggestion?: string(name='Suggestion', description='The fixing suggestion.

>  This parameter is returned only if the value of `RemediationType` is `Analysis`.', example='Console logon is enabled for the RAM user and the RAM user owns an AccessKey pair, while the AccessKey pair has never been used by the RAM user. We recommend that you disable the AccessKey pair for 90 days. If no related issue occurs during this period, you can delete the AccessKey pair.'),
                  }
                ](name='Actions', description='The fixing operations.'),
                remediationType?: string(name='RemediationType', description='The type of the fixing method. Valid values:

*   Manual: manual fixing
*   QuickFix: quick fixing
*   Analysis: auxiliary decision-making', example='Manual'),
              }
            ](name='Remediation', description='The fixing items.'),
          }(name='RemediationMetadata', description='The metadata of the fixing task.'),
          resourceMetadata?: {
            resourcePropertyMetadata?: [ 
              {
                displayName?: string(name='DisplayName', description='The display name of the resource property.', example='AccessKey Pair Last Used At'),
                propertyName?: string(name='PropertyName', description='The name of the resource property.', example='AkLastUsedTime'),
                propertyType?: string(name='PropertyType', description='The type of the resource property.', example='String'),
              }
            ](name='ResourcePropertyMetadata', description='The metadata of the resource properties.'),
          }(name='ResourceMetadata', description='The metadata of the checked resources.'),
          scope?: string(name='Scope', description='The scope of the check item. Valid values:

*   Account: the check item in a single-account governance maturity check
*   ResourceDirectory: the check item in a multi-account governance maturity check', example='Account'),
          stage?: string(name='Stage', description='The status of the check item. Valid values:

*   Released: The check item is released.
*   Beta: The check item is pre-released.', example='Released'),
        }
      ](name='Metadata', description='The metadata objects of a specific metadata type.'),
      type?: string(name='Type', description='The type of the metadata. Valid values:

*   Metric: the check item', example='Metric'),
    }
  ](name='EvaluationMetadata', description='The metadata of a governance maturity check.'),
  requestId?: string(name='RequestId', description='The request ID.', example='16B208DD-86BD-5E7D-AC93-FFD44B6FBDF1'),
}

model ListEvaluationMetadataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListEvaluationMetadataResponseBody(name='body'),
}

/**
 * @summary Queries all available information about check items in a governance maturity check, including the name, ID, description, stage, resource metadata, and fixing guide.
 *
 * @param request ListEvaluationMetadataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListEvaluationMetadataResponse
 */
async function listEvaluationMetadataWithOptions(request: ListEvaluationMetadataRequest, runtime: $RuntimeOptions): ListEvaluationMetadataResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.language)) {
    query['Language'] = request.language;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListEvaluationMetadata',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries all available information about check items in a governance maturity check, including the name, ID, description, stage, resource metadata, and fixing guide.
 *
 * @param request ListEvaluationMetadataRequest
 * @return ListEvaluationMetadataResponse
 */
async function listEvaluationMetadata(request: ListEvaluationMetadataRequest): ListEvaluationMetadataResponse {
  var runtime = new $RuntimeOptions{};
  return listEvaluationMetadataWithOptions(request, runtime);
}

model ListEvaluationMetricDetailsRequest {
  accountId?: long(name='AccountId', description='The Alibaba Cloud account ID of the member. This parameter takes effect only when a multi-account governance maturity check is performed.', example='103144549568****'),
  id?: string(name='Id', description='The ID of the check item.

You can call the [ListEvaluationMetadata](https://help.aliyun.com/document_detail/2841889.html) operation to query the ID of the check item.', example='xfyve5****'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return for a single request. Default value: 5.', example='5'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='AAAAAGEaXR18y1rqykZHIqRuBejOqED4S3Xne33c7zbn****'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
  scope?: string(name='Scope'),
  snapshotId?: string(name='SnapshotId'),
}

model ListEvaluationMetricDetailsResponseBody = {
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results.', example='AAAAAGEaXR18y1rqykZHIqRuBejOqED4S3Xne33c7zbn****'),
  requestId?: string(name='RequestId', description='The request ID.', example='AC9BD94C-D20C-4D27-88D4-89E8D75C****'),
  resources?: [ 
    {
      complianceType?: string(name='ComplianceType', description='The compliance status of the resource. Valid values:

*   NonCompliant: non-compliant.
*   Excluded: ignored.
*   PendingExclusion: to be ignored.
*   PendingInclusion: to be unignored.', example='NonCompliant'),
      regionId?: string(name='RegionId', description='The region ID of the resource.', example='cn-hangzhou'),
      resourceClassification?: string(name='ResourceClassification', description='The check results further analyzed by auxiliary decision-making.

>  This parameter is returned only when the check item supports the auxiliary decision-making feature.', example='RecentUnloginRamUser'),
      resourceId?: string(name='ResourceId', description='The ID of the resource.', example='26435103783237****'),
      resourceName?: string(name='ResourceName', description='The name of the resource.', example='test'),
      resourceOwnerId?: long(name='ResourceOwnerId', description='The ID of the Alibaba Cloud account that owns the resource.', example='176618589410****'),
      resourceProperties?: [ 
        {
          propertyName?: string(name='PropertyName', description='The name of the resource attribute.', example='DisplayName'),
          propertyValue?: string(name='PropertyValue', description='The value of the resource attribute.', example='example'),
        }
      ](name='ResourceProperties', description='The attributes of the resource.'),
      resourceType?: string(name='ResourceType', description='The type of the resource.', example='ACS::RAM::User'),
    }
  ](name='Resources', description='The details of the non-compliant resources.'),
}

model ListEvaluationMetricDetailsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListEvaluationMetricDetailsResponseBody(name='body'),
}

/**
 * @summary Queries the non-compliant resource information of a check item, including the name, ID, category, type, region, and related metadata of non-compliant resources.
 *
 * @param request ListEvaluationMetricDetailsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListEvaluationMetricDetailsResponse
 */
async function listEvaluationMetricDetailsWithOptions(request: ListEvaluationMetricDetailsRequest, runtime: $RuntimeOptions): ListEvaluationMetricDetailsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.id)) {
    query['Id'] = request.id;
  }
  if (!$isNull(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!$isNull(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.scope)) {
    query['Scope'] = request.scope;
  }
  if (!$isNull(request.snapshotId)) {
    query['SnapshotId'] = request.snapshotId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListEvaluationMetricDetails',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the non-compliant resource information of a check item, including the name, ID, category, type, region, and related metadata of non-compliant resources.
 *
 * @param request ListEvaluationMetricDetailsRequest
 * @return ListEvaluationMetricDetailsResponse
 */
async function listEvaluationMetricDetails(request: ListEvaluationMetricDetailsRequest): ListEvaluationMetricDetailsResponse {
  var runtime = new $RuntimeOptions{};
  return listEvaluationMetricDetailsWithOptions(request, runtime);
}

model ListEvaluationResultsRequest {
  accountId?: long(name='AccountId', description='The Alibaba Cloud account ID of the member. This parameter takes effect only when a multi-account governance maturity check is performed.', example='176618589410****'),
  filters?: [ 
    {
      key?: string(name='Key', description='The key of the filter condition. Valid values:

*   ResourceId: the resource ID.
*   ResourceName: the name of the resource.
*   ResourceType: the resource type.', example='ResourceId'),
      values?: [ string ](name='Values', description='The list of filter condition values.'),
    }
  ](name='Filters', description='The filter conditions.'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
  scope?: string(name='Scope'),
  snapshotId?: string(name='SnapshotId'),
}

model ListEvaluationResultsResponseBody = {
  accountId?: long(name='AccountId', description='The Alibaba Cloud account ID of the member.', example='176618589410****'),
  requestId?: string(name='RequestId', description='The request ID.', example='BD57329E-131A-59F4-8746-E1CD8D7B****'),
  results?: {
    evaluationTime?: string(name='EvaluationTime', description='The end time of the overall check. The time is displayed in UTC.', example='2023-12-13T03:35:00Z'),
    metricResults?: [ 
      {
        accountSummary?: {
          nonCompliant?: int32(name='NonCompliant'),
        }(name='AccountSummary'),
        errorInfo?: {
          code?: string(name='Code', description='The error code.', example='EcsInsightEnableFailed'),
          message?: string(name='Message', description='The error message.', example='Unable to enable ECS Insight due to a server error.'),
        }(name='ErrorInfo', description='The error information.

>  This parameter is returned only if the value of `Status` is `Failed`.'),
        evaluationTime?: string(name='EvaluationTime', description='The end time of the check item. The time is displayed in UTC.', example='2023-12-13T03:34:02Z'),
        id?: string(name='Id', description='The ID of the check item.', example='r7xdcu****'),
        resourcesSummary?: {
          nonCompliant?: int32(name='NonCompliant', description='The number of non-compliant resources.', example='2'),
        }(name='ResourcesSummary', description='The checked resources.'),
        result?: double(name='Result', description='The rate of the non-compliant resources.', example='0.67'),
        risk?: string(name='Risk', description='The risk level. Valid values:

*   Error: high risk
*   Warning: medium risk
*   None: no risk', example='Error'),
        status?: string(name='Status', description='The status of the check item. Valid values:

*   Running: The check is in progress.
*   Finished: The check is complete.
*   failed: The check fails.', example='Running'),
      }
    ](name='MetricResults', description='The check results.'),
    status?: string(name='Status', description='The status of the overall check. Valid values:

*   Running: The check is in progress.
*   Finished: The check is complete.
*   failed: The check fails.', example='Running'),
    totalScore?: double(name='TotalScore', description='The overall score.', example='0.6453'),
  }(name='Results', description='The check results, including the status of the overall check and the results of check items.'),
}

model ListEvaluationResultsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListEvaluationResultsResponseBody(name='body'),
}

/**
 * @summary Queries the result and status of a governance check.
 *
 * @param request ListEvaluationResultsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListEvaluationResultsResponse
 */
async function listEvaluationResultsWithOptions(request: ListEvaluationResultsRequest, runtime: $RuntimeOptions): ListEvaluationResultsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.filters)) {
    query['Filters'] = request.filters;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.scope)) {
    query['Scope'] = request.scope;
  }
  if (!$isNull(request.snapshotId)) {
    query['SnapshotId'] = request.snapshotId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListEvaluationResults',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the result and status of a governance check.
 *
 * @param request ListEvaluationResultsRequest
 * @return ListEvaluationResultsResponse
 */
async function listEvaluationResults(request: ListEvaluationResultsRequest): ListEvaluationResultsResponse {
  var runtime = new $RuntimeOptions{};
  return listEvaluationResultsWithOptions(request, runtime);
}

model ListEvaluationScoreHistoryRequest {
  accountId?: long(name='AccountId', description='The Alibaba Cloud account ID of the member. This parameter takes effect only when a multi-account governance maturity check is performed.', example='176618589410****'),
  endDate?: string(name='EndDate', description='The end of the time range to query. Specify the time in the YYYY-MM-DD format.

By default, the historical scores that were generated in the seven days before the current date are queried.', example='2024-07-11'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
  startDate?: string(name='StartDate', description='The beginning of the time range to query. Specify the time in the YYYY-MM-DD format.

You can query the historical scores within the previous 180 days.', example='2024-06-11'),
}

model ListEvaluationScoreHistoryResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='AC9BD94C-D20C-4D27-88D4-89E8D75C051B'),
  scoreHistory?: {
    totalScoreHistory?: [ 
      {
        evaluationTime?: string(name='EvaluationTime', description='The time when the score was generated. The time is in UTC.', example='2024-06-30T03:34:02Z'),
        score?: double(name='Score', description='The score.

Valid values: 0 to 1.', example='0.6753'),
      }
    ](name='TotalScoreHistory', description='The historical scores.'),
  }(name='ScoreHistory', description='The historical scores.'),
}

model ListEvaluationScoreHistoryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListEvaluationScoreHistoryResponseBody(name='body'),
}

/**
 * @summary Queries the historical scores of a governance maturity check.
 *
 * @param request ListEvaluationScoreHistoryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListEvaluationScoreHistoryResponse
 */
async function listEvaluationScoreHistoryWithOptions(request: ListEvaluationScoreHistoryRequest, runtime: $RuntimeOptions): ListEvaluationScoreHistoryResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.endDate)) {
    query['EndDate'] = request.endDate;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.startDate)) {
    query['StartDate'] = request.startDate;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListEvaluationScoreHistory',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the historical scores of a governance maturity check.
 *
 * @param request ListEvaluationScoreHistoryRequest
 * @return ListEvaluationScoreHistoryResponse
 */
async function listEvaluationScoreHistory(request: ListEvaluationScoreHistoryRequest): ListEvaluationScoreHistoryResponse {
  var runtime = new $RuntimeOptions{};
  return listEvaluationScoreHistoryWithOptions(request, runtime);
}

model RunEvaluationRequest {
  accountId?: long(name='AccountId', description='The Alibaba Cloud account ID of the member. This parameter takes effect only when a multi-account governance maturity check is performed.', example='176618589410****'),
  metricIds?: [ string ](name='MetricIds', description='The IDs of the check items to be checked.'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
  scope?: string(name='Scope', description='The check range of the governance maturity check. Valid values:

*   Account (default): A single-account governance maturity check is performed to check only the Alibaba Cloud account that you use to access Cloud Governance Center.
*   ResourceDirectory: A multi-account governance maturity check is performed to check all members within a resource directory. Before you perform a multi-account governance maturity check, you must enable the multi-account governance maturity check feature.', example='ResourceDirectory'),
}

model RunEvaluationShrinkRequest {
  accountId?: long(name='AccountId', description='The Alibaba Cloud account ID of the member. This parameter takes effect only when a multi-account governance maturity check is performed.', example='176618589410****'),
  metricIdsShrink?: string(name='MetricIds', description='The IDs of the check items to be checked.'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
  scope?: string(name='Scope', description='The check range of the governance maturity check. Valid values:

*   Account (default): A single-account governance maturity check is performed to check only the Alibaba Cloud account that you use to access Cloud Governance Center.
*   ResourceDirectory: A multi-account governance maturity check is performed to check all members within a resource directory. Before you perform a multi-account governance maturity check, you must enable the multi-account governance maturity check feature.', example='ResourceDirectory'),
}

model RunEvaluationResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='2D3E2A3A-F2B8-578D-9659-3195F94A****'),
}

model RunEvaluationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RunEvaluationResponseBody(name='body'),
}

/**
 * @summary Performs a governance maturity check.
 *
 * @param tmpReq RunEvaluationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RunEvaluationResponse
 */
async function runEvaluationWithOptions(tmpReq: RunEvaluationRequest, runtime: $RuntimeOptions): RunEvaluationResponse {
  tmpReq.validate();
  var request = new RunEvaluationShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.metricIds)) {
    request.metricIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.metricIds, 'MetricIds', 'json');
  }
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.metricIdsShrink)) {
    query['MetricIds'] = request.metricIdsShrink;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.scope)) {
    query['Scope'] = request.scope;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'RunEvaluation',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Performs a governance maturity check.
 *
 * @param request RunEvaluationRequest
 * @return RunEvaluationResponse
 */
async function runEvaluation(request: RunEvaluationRequest): RunEvaluationResponse {
  var runtime = new $RuntimeOptions{};
  return runEvaluationWithOptions(request, runtime);
}

model UpdateAccountFactoryBaselineRequest {
  baselineId?: string(name='BaselineId', description='The baseline ID.', example='afb-bp1pq3emlkt27vsj****'),
  baselineItems?: [ 
    {
      config?: string(name='Config', description='The configurations of the baseline item. The value of this parameter is a JSON string.', example='{\\\\"EnabledServices\\\\":[\\\\"CEN_TR\\\\",\\\\"CDT\\\\",\\\\"CMS\\\\",\\\\"KMS\\\\"]}'),
      name?: string(name='Name', description='The name of the baseline item.', example='ACS-BP_ACCOUNT_FACTORY_VPC'),
      version?: string(name='Version', description='The version of the baseline item.', example='1.0'),
    }
  ](name='BaselineItems', description='The baseline items.

You can call the [ListAccountFactoryBaselineItems](~~ListAccountFactoryBaselineItems~~) operation to query a list of baseline items supported by the account factory in Cloud Governance Center.'),
  baselineName?: string(name='BaselineName', description='The name of the baseline.'),
  description?: string(name='Description', description='The description of the baseline.'),
  regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
}

model UpdateAccountFactoryBaselineResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='C18A891D-7B04-51A1-AAC6-201727A361CE'),
}

model UpdateAccountFactoryBaselineResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateAccountFactoryBaselineResponseBody(name='body'),
}

/**
 * @summary Updates a baseline of the account factory.
 *
 * @param request UpdateAccountFactoryBaselineRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateAccountFactoryBaselineResponse
 */
async function updateAccountFactoryBaselineWithOptions(request: UpdateAccountFactoryBaselineRequest, runtime: $RuntimeOptions): UpdateAccountFactoryBaselineResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.baselineId)) {
    query['BaselineId'] = request.baselineId;
  }
  if (!$isNull(request.baselineItems)) {
    query['BaselineItems'] = request.baselineItems;
  }
  if (!$isNull(request.baselineName)) {
    query['BaselineName'] = request.baselineName;
  }
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateAccountFactoryBaseline',
    version = '2021-01-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates a baseline of the account factory.
 *
 * @param request UpdateAccountFactoryBaselineRequest
 * @return UpdateAccountFactoryBaselineResponse
 */
async function updateAccountFactoryBaseline(request: UpdateAccountFactoryBaselineRequest): UpdateAccountFactoryBaselineResponse {
  var runtime = new $RuntimeOptions{};
  return updateAccountFactoryBaselineWithOptions(request, runtime);
}

